class Solution {
    public int[] twoSum(int[] nums, int target) {
        int[] sum = new int[2];
        int left = 0;
        boolean felg = false;
        while(left < nums.length-1) {
            int rigth = nums.length-1;
            while(left < rigth) {
                if(nums[left]+nums[rigth] == target) {
                    sum[0] = left;
                    sum[1] = rigth;
                    felg = true;
                    break;
                }
                rigth--;
            }
            left++;
            if(felg) {
                break;
            }
        }
        return sum;
    }
}